<%@page import="study.top.mydb.items.ProductAllItem"%>
<%@page import="study.top.mydb.items.Category2Item"%>
<%@page import="study.top.mydb.items.Category1Item"%>
<%@page import="java.util.ArrayList"%>
<%@page import="study.top.mydb.Category2"%>
<%@page import="study.top.mydb.Category1"%>
<%@page import="study.top.mydb.items.ProductItem"%>
<%@page import="study.top.mydb.Product"%>
<%@page import="study.top.common.PatternChecker"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page trimDirectiveWhitespaces="true" %>
<%
	String seq = request.getParameter("seq");

	if (!PatternChecker.getInstance().isValue(seq)) {
		out.print("<script type='text/javascript'>alert('파라미터가 없습니다.');history.back();</script>");
		return;
	}

	int product_number = Integer.parseInt(seq);
%>
<%@ include file="dbcon.jsp"%>
<%	
	// 상품 조회
	Product Product = new Product();
	ProductAllItem item = Product.show(product_number);


	
	// 카테고리1 목록에 대한 ArrayList 받아오기
	Category1 dept1 = new Category1();
	ArrayList<Category1Item> Ca1_list = dept1.selectCategory1List();
	
	// 카테고리2 목록에 대한 ArrayList 받아오기
	Category2 dept2 = new Category2();
	ArrayList<Category2Item> Ca2_list = dept2.selectCategory2List(1);

	// DB접속 해제
	DBHandler.getInstance().disconnect();
%>
<!DOCTYPE html>
<html lang="ko">
<head>
	<meta charset="UTF-8" />
	<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
	<title>파싱해서 DB에 입력할 상품</title>
	
	<!-- 모바일 웹 페이지 설정 -->
	<link rel="shortcut icon" href="assets/ico/favicon.png" />
	<link rel="apple-touch-icon-precomposed"
	href="assets/ico/apple-touch-icon-57-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="72x72"
	href="assets/ico/apple-touch-icon-72-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="114x114"
	href="assets/ico/apple-touch-icon-114-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="144x144"
	href="assets/ico/apple-touch-icon-144-precomposed.png" />
	
	<!-- bootstrap -->
	<link rel="stylesheet" type="text/css"
	href="assets/css/bootstrap.min.css" />
	<!-- 나눔고딕 웹 폰트 적용 -->
	<link rel="stylesheet" type="text/css" href="assets/css/nanumfont.css" />
	<!-- 반응형 웹을 지원하지 않을 경우 -->
	<!-- <link rel="stylesheet" href="assets/css/non-responsive.css" /> -->

	<!-- IE8 이하 버전 지원 -->
	<!--[if lt IE 9]>
		<script type="text/javascript" src="assets/js/html5shiv.js"></script>
		<script type="text/javascript" src="assets/js/respond.min.js"></script>
		<![endif]-->

	<!-- IE10 반응형 웹 버그 보완 -->
	<!--[if gt IE 9]>
		<link rel="stylesheet" type="text/css" href="assets/css/ie10.css" />
		<script type="text/javascript" src="assets/js/ie10.js"></script>
		<![endif]-->
</head>
<body>
	<div class="container">
		<div class="page-header">
			<h1>저장 된 상품 정보</h1>
		</div>

		<form id="frmStudentView" class="form-horizontal" role="form"
			method="post" action="">
			
			<!--  상품번호 자동입력  -->
        	<input type="hidden" name="seq" value="<%=seq%>">
        	
			<fieldset>

				<!-- 입력양식 -->
				<div class="form-group">
					<label for="Title" class="col-md-2 control-label">상품 명</label>
					<div class="col-md-10">
						<p class="form-control-static"><%=item.getTitle()%></p>
					</div>
				</div>

				<div class="form-group">
					<label for="Imgurl" class="col-md-2 control-label">이미지 & 경로</label>
					<div class="col-md-10">
						<img width="200" height="200" src="<%=item.getImgurl()%>">
						<p class="form-control-static"><%=item.getImgurl()%>
						</p>
					</div>
				</div>

				<div class="form-group">
					<label for="C1_name" class="col-md-2 control-label">카테고리 1</label>
					<div class="col-md-10">
						<p class="form-control-static"><%=item.getC1_name()%>
						</p>
					</div>
				</div>

				<div class="form-group">
					<label for="C2_name" class="col-md-2 control-label">카테고리 2</label>
					<div class="col-md-10">
						<p class="form-control-static"><%=item.getC2_name()%>
						</p>
					</div>
				</div>
				
				<div class="form-group">
					<label for="idnum" class="col-md-2 control-label">브랜드</label>
					<div class="col-md-10">
						<p class="form-control-static"><%=item.getBrand()%>
						</p>
					</div>
				</div>
				
				<div class="form-group">
					<label for="Docid" class="col-md-2 control-label">상품 코드</label>
					<div class="col-md-10">
						<p class="form-control-static"><%=item.getDocid()%>
						</p>
					</div>
				</div>
				
				<div class="form-group">
					<label for="Maker" class="col-md-2 control-label">제조사</label>
					<div class="col-md-10">
						<p class="form-control-static"><%=item.getMaker()%>
						</p>
					</div>
				</div>
				
				<div class="form-group">
					<label for="Price_max" class="col-md-2 control-label">최고가</label>
					<div class="col-md-10">
						<p class="form-control-static"><%=item.getPrice_max()%>
						</p>
					</div>
				</div>
				
				<div class="form-group">
					<label for="Price_min" class="col-md-2 control-label">최저가</label>
					<div class="col-md-10">
						<p class="form-control-static"><%=item.getPrice_min()%>
						</p>
					</div>
				</div>
				
				<div class="form-group">
					<label for="Recommend" class="col-md-2 control-label">추천 수</label>
					<div class="col-md-10">
						<p class="form-control-static"><%=item.getRecommend()%>
						</p>
					</div>
				</div>
				
				<div class="form-group">
					<label for="Is_open" class="col-md-2 control-label">존재 여부(Y/N)</label>
					<div class="col-md-10">
						<p class="form-control-static"><%=item.getIs_open()%>
						</p>
					</div>
				</div>
				
				<div class="form-group">
					<label for="Decription" class="col-md-2 control-label">상품 내용</label>
					<div class="col-md-10">
						<p class="form-control-static"><%=item.getDecription()%>
						</p>
					</div>
				</div>

				<div class="form-group">
					<label for="Edit_date" class="col-md-2 control-label">상품 수정날짜</label>
					<div class="col-md-10">
						<p class="form-control-static"><%=item.getEdit_date()%>
						</p>
					</div>
				</div>
				
				<div class="form-group">
					<label for="Reg_date" class="col-md-2 control-label">상품 등록날짜</label>
					<div class="col-md-10">
						<p class="form-control-static"><%=item.getReg_date()%>
						</p>
					</div>
				</div>

				<div class="form-group">
					<div class="col-md-offset-2 col-md-10">
						<div class="row">
							<div class="col-md-6">
								<a href="aProductList.jsp" class="btn btn-primary btn-block">상품 목록보기</a>
							</div>
							<div class="col-md-6">
								<a href="aProductAddSearch.jsp" class="btn btn-info btn-block">상품 더 추가하기</a>
							</div>
						</div>
					</div>
				</div>

			</fieldset>
		</form>
	</div>

	<!-- Javascript -->
	<script src="assets/js/jquery.js"></script>
	<script src="assets/js/bootstrap.min.js"></script>

	<script type="text/javascript">
		$(function() {
			$("#frmStudentView").submit(function() {
				// 이동할 전송 페이지가 어디인지 검사
				var target = $(this).target;
			});
		});
	</script>

	<script type="text/javascript">
		$(function() {
			// id속성이 "delete"인 요소에 대한 click이벤트
			$("#delete").click(function() {
				// 사용자에게 물어본다.
				if (!confirm("정말 삭제하시겠습니까?")) {
					// "취소"를 선택한 경우 처리 중단
					return false;
				}
			});
		});
	</script>
</body>
</html>